<?php
include "includeFiles.php";
if(empty($cateid)) $cateid=11410;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $C['Title'];?></title>
<Link href="../uploadfile/ico/<?php echo $C['ICO'];?>" rel="Shortcut Icon">
<meta name="Keywords" content="<?php echo $C['Keywords'];?>">
<meta name="description" content="<?php echo $C['Description'];?>">
<Meta name="Copyright" Content="<?php echo $C['CopyRight'];?>">
<link href="css/css.css" rel="stylesheet" type="text/css" />

</head>
<?php
include_once "checklogin.php";

if(!empty($id)){
	if($action=="add"){
		$sql="select * from hy_b_sys_products where SysProductsID='".$id."'";
		$objDb->query($sql);
		$row=$objDb->get_data();
		if(!$row){
			echo "<script>location.href='index.php';</script>";
			exit;
		}
		else{
			$pname=$row[0]["ProductName"];
			$productCateID = substr($row[0]["CateID"],0,3);
			if($productCateID!="114"){$productCateID="";}else{$productCateID=$row[0]["CateID"];}
		}
		$sql="select * from hy_member_Favorites where productID='".$id."' and memberID='".$_SESSION["user_id"]."'";
		$objDb->query($sql);
		$row=$objDb->get_data();
		if($row){
			echo "<script>alert('您已经收藏了此产品。');history.go(-1);</script>";
			exit;
		}
		$strtime=date("Y-m-d H:i:s",time());
		$sql="insert into hy_member_Favorites(`memberID`,`productID`,`productName`,`productCateID`,`createdate`) values('".$_SESSION["user_id"]."','$id','$pname','$productCateID','$strtime') ";
		//echo $sql;exit;
		$result=$objDb->query($sql);
		if($result){
			echo "<script>alert('收藏成功。');history.go(-1);</script>";
			exit;
		}
		else{
			echo "<script>alert('收藏失败，请重试。');history.go(-1);</script>";
			exit;
		}
	}
	else if($action=="del"){
		$sql="delete from hy_member_Favorites where id=$id";
		$result=$objDb->query($sql);
		if($result){
			echo "<script>alert('删除成功。');location.href='mysc.php';</script>";
			exit;
		}
		else{
			echo "<script>alert('删除失败，请重试。');history.go(-1);</script>";
			exit;
		}
	}
}

?>
  

<body>
<?php include_once('header.php');?>

<div class="hh"></div>
<table width="1000" height="236" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td width="756" valign="top">
    <div class="lefttitle">
      <h3><span class="titlebai">温馨提示</span></h3>
    </div>
    <div class="leftnr"><font color="black">
<h3 align="center" ><br />
      感谢您在本店购物！<br />
      您的订单已提交成功</h3>
    <h3 align="center" >请记住您的订单号: 
        <?=$oid?>
        <br />
        您的应付款金额为: ￥
        <?=$price?>
      </h3>
	  </font>
  </div>
    </div>
    </td>
    <td width="7"></td>
    <?php include_once('right.php');?>

  
</table>
<div class="hh"></div>
<div class="bian"></div>
<?php include_once('footer.php');?>

</body>
</html>